package com.cxx.purchasecharge.core.model.persistence;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

import com.cxx.purchasecharge.core.model.BaseModel;
import com.cxx.purchasecharge.core.model.GenderCode;

/**
 * 联系人
 */
@Entity
@Table (name = "pc_contact")
@NamedQuery (name = "Contact.findByMobilePhone", query = "select c from Contact c where c.mobilePhone=:mobilePhone")
public class Contact extends BaseModel
{
    private static final long serialVersionUID = 1L;

    private long id;
    private String name;
    private Customer customer;
    private GenderCode genderCode = GenderCode.UNKNOWN;
    private String mobilePhone;
    private long qq;
    private String skype;
    private String email;
    /**
     * 微信
     */
    private String weiXin;
    /**
     * 旺旺
     */
    private String wangWang;
    private String dept;
    /**
     * 职位
     */
    private String post;
    private String concernedBusiness;
    private String interest;
    private String photoPath;
    /**
     * 家庭住址
     */
    private String address;

    private boolean deleted = false;
    /**
     * 个人主页
     */
    private String webSite;

    /**
     * 湖南-永州-东安-白牙市镇
     */
    private String region;

    private String comment;

    private Date createDate;
    private Date lastUpdated;
    private long userSigned;
    private long userCreatedBy;
    private long userUpdatedBy;
    private boolean sharable = false;
    private boolean isPrefered;

    private ContactType type;

    public Contact ()
    {
    }

    public Contact (String name)
    {
        this.name = name;
    }

    @Id
    @GeneratedValue (strategy = GenerationType.AUTO)
    public long getId ()
    {
        return id;
    }

    public void setId (long id)
    {
        this.id = id;
    }

    @Column (nullable = false)
    public String getName ()
    {
        return name;
    }

    public void setName (String name)
    {
        this.name = name;
    }

    @ManyToOne
    @JoinColumn (name = "customer_id")
    public Customer getCustomer ()
    {
        return customer;
    }

    public void setCustomer (Customer customer)
    {
        this.customer = customer;
    }

    public GenderCode getGenderCode ()
    {
        return genderCode;
    }

    public void setGenderCode (GenderCode genderCode)
    {
        this.genderCode = genderCode;
    }

    @Column (length = 50)
    public String getMobilePhone ()
    {
        return mobilePhone;
    }

    public void setMobilePhone (String mobilePhone)
    {
        this.mobilePhone = mobilePhone;
    }

    public long getQq ()
    {
        return qq;
    }

    public void setQq (long qq)
    {
        this.qq = qq;
    }

    public String getSkype ()
    {
        return skype;
    }

    public void setSkype (String skype)
    {
        this.skype = skype;
    }

    public String getEmail ()
    {
        return email;
    }

    public void setEmail (String email)
    {
        this.email = email;
    }

    public String getWeiXin ()
    {
        return weiXin;
    }

    public void setWeiXin (String weiXin)
    {
        this.weiXin = weiXin;
    }

    public String getWangWang ()
    {
        return wangWang;
    }

    public void setWangWang (String wangWang)
    {
        this.wangWang = wangWang;
    }

    public String getDept ()
    {
        return dept;
    }

    public void setDept (String dept)
    {
        this.dept = dept;
    }

    public String getConcernedBusiness ()
    {
        return concernedBusiness;
    }

    public void setConcernedBusiness (String concernedBusiness)
    {
        this.concernedBusiness = concernedBusiness;
    }

    public String getPost ()
    {
        return post;
    }

    public void setPost (String post)
    {
        this.post = post;
    }

    public String getInterest ()
    {
        return interest;
    }

    public void setInterest (String interest)
    {
        this.interest = interest;
    }

    public String getPhotoPath ()
    {
        return photoPath;
    }

    public void setPhotoPath (String photoPath)
    {
        this.photoPath = photoPath;
    }

    public String getAddress ()
    {
        return address;
    }

    public void setAddress (String address)
    {
        this.address = address;
    }

    public String getWebSite ()
    {
        return webSite;
    }

    public void setWebSite (String webSite)
    {
        this.webSite = webSite;
    }

    public boolean isDeleted ()
    {
        return deleted;
    }

    public void setDeleted (boolean deleted)
    {
        this.deleted = deleted;
    }

    public String getRegion ()
    {
        return region;
    }

    public void setRegion (String region)
    {
        this.region = region;
    }

    @Column (length = 1024)
    public String getComment ()
    {
        return comment;
    }

    public void setComment (String comment)
    {
        this.comment = comment;
    }

    public Date getCreateDate ()
    {
        return createDate;
    }

    public void setCreateDate (Date createDate)
    {
        this.createDate = createDate;
    }

    public Date getLastUpdated ()
    {
        return lastUpdated;
    }

    public void setLastUpdated (Date lastUpdated)
    {
        this.lastUpdated = lastUpdated;
    }

    @ManyToOne
    @JoinColumn (name = "contact_type_id")
    public ContactType getType ()
    {
        return type;
    }
    
    public void setType (ContactType type)
    {
        this.type = type;
    }

    public long getUserSigned ()
    {
        return userSigned;
    }

    public void setUserSigned (long userSigned)
    {
        this.userSigned = userSigned;
    }

    public long getUserCreatedBy()
    {
        return userCreatedBy;
    }

    public void setUserCreatedBy(long userCreatedBy)
    {
        this.userCreatedBy = userCreatedBy;
    }

    public long getUserUpdatedBy()
    {
        return userUpdatedBy;
    }

    public void setUserUpdatedBy(long userUpdatedBy)
    {
        this.userUpdatedBy = userUpdatedBy;
    }

    public boolean isSharable ()
    {
        return sharable;
    }

    public void setSharable (boolean sharable)
    {
        this.sharable = sharable;
    }

    public boolean isPrefered ()
    {
        return isPrefered;
    }

    public void setPrefered (boolean isPrefered)
    {
        this.isPrefered = isPrefered;
    }

}
